﻿CREATE TABLE [dbo].[AmixDocumente] (
    [IDDocument]              INT             IDENTITY (1, 1) NOT NULL,
    [NrInventar]              VARCHAR (20)    NOT NULL,
    [IdClasificare]           INT             CONSTRAINT [DF_AmixDocumente_IdClasificare] DEFAULT ((0)) NOT NULL,
    [IDDepartament]           INT             CONSTRAINT [DF_AmixDocumente_IDDepartament] DEFAULT ((0)) NOT NULL,
    [ContAmortizare]          [dbo].[TipCont] NULL,
    [ValoareInventar]         DECIMAL (18, 2) CONSTRAINT [DF_AmixDocumente_ValoareInventar] DEFAULT ((0)) NOT NULL,
    [DurataAmortizare]        INT             CONSTRAINT [DF_AmixDocumente_DurataAmortizare] DEFAULT ((0)) NOT NULL,
    [RegimAmortizare]         SMALLINT        CONSTRAINT [DF_AmixDocumente_RegimAmortizare] DEFAULT ((1)) NOT NULL,
    [DataDoc]                 DATETIME        CONSTRAINT [DF_AmixDocumente_DataDoc] DEFAULT (getdate()) NOT NULL,
    [NumarDoc]                DECIMAL (10)    NOT NULL,
    [DurExtindere]            INT             CONSTRAINT [DF_AmixDocumente_DurExtindere] DEFAULT ((0)) NOT NULL,
    [CodUnitate]              SMALLINT        CONSTRAINT [DF_DocAmix_CodUnitate] DEFAULT ((0)) NOT NULL,
    [IDMod]                   SMALLINT        CONSTRAINT [DF_AmixDocumente_IDMod] DEFAULT ((1)) NOT NULL,
    [IDTipDocument]           SMALLINT        CONSTRAINT [DF_DocAmix_IDTipDocument] DEFAULT ((0)) NOT NULL,
    [ContCheltuiala]          [dbo].[TipCont] NULL,
    [ContImobilizare]         [dbo].[TipCont] NULL,
    [Luna]                    SMALLINT        CONSTRAINT [DF_DocAmix_Luna] DEFAULT ((0)) NOT NULL,
    [Anul]                    SMALLINT        CONSTRAINT [DF_DocAmix_Anul] DEFAULT ((0)) NOT NULL,
    [AmortizareLuna]          DECIMAL (18, 2) CONSTRAINT [DF_AmixDocumente_AmortizareLuna] DEFAULT ((0)) NOT NULL,
    [AmortizareAn]            DECIMAL (18, 2) CONSTRAINT [DF_AmixDocumente_AmortizareAn] DEFAULT ((0)) NOT NULL,
    [ValoareAmortizata]       DECIMAL (18, 2) CONSTRAINT [DF_AmixDocumente_ValoareAmortizata] DEFAULT ((0)) NOT NULL,
    [ContTransfer]            [dbo].[TipCont] NULL,
    [IDMijlocFix]             INT             NULL,
    [PunereInFunctiune]       DATETIME        CONSTRAINT [DF_AmixDocumente_PunereInFunctiune] DEFAULT (getdate()) NOT NULL,
    [Compus]                  SMALLINT        CONSTRAINT [DF_AmixDocumente_Compus] DEFAULT ((0)) NOT NULL,
    [AmortizarePrimulAn]      DECIMAL (18, 2) CONSTRAINT [DF_AmixDocumente_AmortizarePrimulAn] DEFAULT ((0)) NULL,
    [IDGestionar]             SMALLINT        CONSTRAINT [DF_AmixDocumente_IDGestionar] DEFAULT ((1)) NOT NULL,
    [ValoareSuplimentara]     DECIMAL (18, 2) CONSTRAINT [DF_AmixDocumente_ValoareSuplimentara] DEFAULT ((0)) NOT NULL,
    [LuniAmortizate]          INT             CONSTRAINT [DF_AmixDocumente_LuniAmortizate] DEFAULT ((0)) NULL,
    [IDBK]                    INT             NULL,
    [InFolosinta]             BIT             CONSTRAINT [DF_AmixDocumente_InFolosinta] DEFAULT ((0)) NULL,
    [Categorie]               VARCHAR (100)   NULL,
    [Denumire]                VARCHAR (250)   CONSTRAINT [DF_AmixDocumente_Den] DEFAULT ('') NOT NULL,
    [ComisiaRec]              VARCHAR (250)   CONSTRAINT [DF_AmixDocumente_Mc] DEFAULT ('') NOT NULL,
    [IDUnitateMasura]         SMALLINT        NULL,
    [ContTransferForSuperior] VARCHAR (50)    NULL,
    [CantitateOI]             DECIMAL (18, 2) DEFAULT ((0)) NOT NULL,
    [IDSursaFinantare]        SMALLINT        NULL,
    CONSTRAINT [PK_DocAmix] PRIMARY KEY CLUSTERED ([IDDocument] ASC),
    CONSTRAINT [FK_AmixDocumente_AmixGestionari] FOREIGN KEY ([IDGestionar]) REFERENCES [dbo].[AmixGestionari] ([IDGestionar]),
    CONSTRAINT [FK_AmixDocumente_SurseFinantare] FOREIGN KEY ([IDSursaFinantare]) REFERENCES [dbo].[SurseFinantare] ([IDSursaFinantare]),
    CONSTRAINT [FK_DocAmix_DocAmix] FOREIGN KEY ([IDDocument]) REFERENCES [dbo].[AmixDocumente] ([IDDocument])
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Backup-ul registrului', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'AmixDocumente', @level2type = N'COLUMN', @level2name = N'IDDocument';

